package web

import (
	"ksd-social-api/commons/base/controller"
	"ksd-social-api/modules/note/model/context"
)

type NoteStudyUserRecordsController struct {
	controller.BaseController
}

/**
 * @author feige
 * @date 2023-10-08
 * @desc 保存用户课程学习记录
 */
func (web *NoteStudyUserRecordsController) SaveNoteStudyUserRecords() {
	// 1: 定义一个接受分页信息的上下文
	noteUserRecordsContext := context.NoteStudyUserRecordsContext{}
	// 2: 开始绑定参数
	web.BindJSON(&noteUserRecordsContext)

	noteUserRecordsContext.UserId = web.GetUserId()
	noteUserRecordsContext.Uuid = web.GetUuid()
	noteUserRecordsContext.Avatar = web.GetUserAvatar()
	noteUserRecordsContext.Nickname = web.GetUserNickname()
	noteUserRecordsContext.Username = web.GetUsername()
	noteUserRecordsContext.SystemId = web.GetSystemId()
	noteUserRecordsContext.SystemName = web.GetSystemName()
	// 保存
	records := noteUserRecordsService.SaveNoteStudyUserRecordsChapter(&noteUserRecordsContext)
	web.Ok(records)
}
